@layout("/common/_curd/_container.html"){

<script type="text/javascript">
	var ctx = "${basePath}";
	var grid_selector = "#grid-table";
	var pager_selector = "#grid-pager";
	
	$(function(){
		initGrid();
		initMenuBtn("btns", "${code}");
	});
	
	function initGrid(){
		var grid_url = ctx + "/${code}/list";
		var _colnames = [
						"项目名称",
						"申报单位", 
						"开始时间", 
						"结束时间", 
						"付款方式", 
						"合同签订时间", 
						"质保时间", 
						"合同金额", 
						"计划完成时间", 
						"附件", 
						"供应商", 
						"联系人", 
						"联系电话"
		];
		var _colmodel = [
						{name:"pname", align:"center", index:"pro_id", width:200,formatter:function (value, row, index) {
							return '<a href="#" class="btn btn-btn btn-info btn-xs" onclick="view('+"'"+index.pro_id+"'"+')">'+value+'</a>';
						}},
						{name:"fullname", align:"center", index:"dept_id", width:100},
						{name:"start", align:"center", index:"start", width:100,formatter:"date",formatoptions: {srcformat:'Y-m-d H:i:s',newformat:'Y-m'}},
						{name:"over", align:"center", index:"over", width:100,formatter:"date",formatoptions: {srcformat:'Y-m-d H:i:s',newformat:'Y-m'}},
						{name:"payment", align:"center", index:"payment", width:100},
						{name:"sign_date", align:"center", index:"sign_date", width:100,formatter:"date",formatoptions: {srcformat:'Y-m-d H:i:s',newformat:'Y-m-d'}},
						{name:"warranty", align:"center", index:"warranty", width:100},
						{name:"money", align:"center", index:"money", width:100},
						{name:"plan_date", align:"center", index:"plan_date", width:100,formatter:"date",formatoptions: {srcformat:'Y-m-d H:i:s',newformat:'Y-m'}},
						{name:"annex", align:"center", index:"annex", width:100,formatter:function (value, row, index) {
							return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="annex('+"'"+index.id+"'"+')">'+"查看附件"+'</a>';
						}},
						{name:"suppliers_ids", align:"center", index:"suppliers_ids", width:100,formatter:function (value, row, index) {
							return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="supp('+"'"+index.id+"'"+')">'+"查看供应商"+'</a>';
						}},
						{name:"contact", align:"center", index:"contact", width:100},
						{name:"tel", align:"center", index:"tel", width:100}
		];
		
		jQuery(grid_selector).jqGrid({
			url : grid_url,
		    shrinkToFit : true,
			colNames : _colnames,
			colModel : _colmodel, 
			jsonReader : {id :"id"},
			pager : pager_selector,
			postData : {sort : "id", order : "desc"}
		});
	}
	function annex(pid){
		var index = layer.open({
			type: 2,
			title:'查看附件',
			area: ['90%', '70%'],
			maxmin:true,
			shadeClose: true, //点击遮罩关闭

			content:  '/contract/annex?id=' + pid
		});

		this.layerIndex = index;
	}
	function supp(pid){
		var index = layer.open({
			type: 2,
			title:'查看供应商',
			area: ['90%', '70%'],
			maxmin:true,
			shadeClose: true, //点击遮罩关闭

			content:  '/contract/supp?id=' + pid
		});

		this.layerIndex = index;
	}
	function view(pid){
		var index = layer.open({
			type: 2,
			title:'查看详情',
			area: ['90%', '70%'],
			maxmin:true,
			shadeClose: true, //点击遮罩关闭

			content:  '/projects/view?id=' + pid
		});

		this.layerIndex = index;
	}
</script>


	<!-- 配置 grid -->
	<div class="row">
		<div class="col-xs-12 tb-grid">
			<!-- 配置 查询 -->
			@ var _col=[
@		{name:"主键", index:"id", type:"text"},
			@		{name:"项目编号", index:"pro_id", type:"text"},
			@		{name:"申报单位", index:"dept_id", type:"text"},
			@		{name:"开始时间", index:"start", type:"text"},
			@		{name:"结束时间", index:"over", type:"text"},
			@		{name:"付款方式", index:"payment", type:"text"},
			@		{name:"合同签订时间", index:"sign_date", type:"text"},
			@		{name:"质保时间", index:"warranty", type:"text"},
			@		{name:"合同金额", index:"money", type:"text"},
			@		{name:"计划完成时间", index:"plan_date", type:"text"},
			@		{name:"附件", index:"annex", type:"text"},
			@		{name:"供应商", index:"suppliers_ids", type:"text"},
			@		{name:"联系人", index:"contact", type:"text"},
			@		{name:"联系电话", index:"tel", type:"text"}
			@];
			@ include("/common/_function/_search.html",{"col":_col}){}

			<!-- 按钮 -->
			<!--<button type="button"  class="btn btn-info" id="contract_view">查看</button>-->
			<button type="button"  class="btn btn-info" id="contract_edit">修改</button>
			<button type="button"  class="btn btn-info" id="contract_remove">删除</button>
			<!-- grid -->
			<table id="grid-table"></table>
			<!-- 分页-->
			<div id="grid-pager"></div>
		</div>
	</div>
	
	<!-- 引入所需的js -->
	@include("/common/_listscript.html"){}
	
@}	